#!/bin/sh

# Part of Zombie Navigator
# Copyright © 2015  Zombie Navigator Developers

dir="`dirname "$0"`"/..
cd "$dir"


printf "\n"

[ "$1" ] && {
	find src/ -name '*.js' -exec sh -c \
		"printf '%s: \n' "'"$1"'" ; grep 'require(' "'"$1"'" | sed 's/^.*require(\([^)]*\)).*$/\1/' | sort | uniq | grep --color -- "'"$2"'" && printf '\n'" -- {} "$1" \;
:;} || {
	find src/ -name '*.js' -exec sh -c \
		"printf '%s: \n\n' "'"$1"'" ; grep 'require(' "'"$1"'" | sed 's/^.*require(\([^)]*\)).*$/\1/' | sort | uniq" -- {} \;
}


# vim: ts=4 noet ai

